﻿<html>
<head>
    <title>XHttpRequest sample</title>
    <script type="text/javascript" src="jquery-1.7.min.js"></script>
    <script type="text/javascript">
        var int = self.setInterval("updateRandom()", 1000);

        function updateRandom() {
            $.ajax({
                url: "/random",
                dataType: 'json',
                cache: false,
                success: function (data, successCode, jqXHR) {                    
                    $('span#divRandom').text(data.value);
                },
                error: function (jqXHR, errorType, ex) {
                    $('span#divRandom').text(errorType);
                }
            });
        }
    </script>
</head>
<body>
    Your random number is: <b><span id="divRandom"></span></b>!
</body>
</html>
